﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using IRC.IRepairClouds.DataLayer.Cache;
using System.Reflection;

namespace IRC.IRepairClouds.WebClient
{
    public partial class StartupMaster : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Convert.ToBoolean(ConfigurationManager.AppSettings["Application.ShowInfo"]))
                {
                    var version = CacheManager.Customs.Get(
                        () => Assembly.Load("IRC.IRepairClouds.WebClient").GetName().Version.ToString(3),
                        "Assembly.Version"
                    );
                    LiteralAppInfo.Text = "Environment: " + ConfigurationManager.AppSettings["Application.Environment"] + ", Version: " + version;
                    var ud = CacheManager.Users.Current;
                    //if (ud != null)
                    //    LiteralAppInfo.Text += ", TimeZone: " + ud.TimeZone.Cached.TimeZone.Id;
                }
                else
                    LiteralAppInfo.Text = "";
            }
        }
    }
}
